package dbreflection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.HashMap;

/**
 * User: [J0k3r]
 * Date: 14.11.2008
 * Time: 3:30:39
 */
public class ConnectionManager
{
    private static HashMap< String , Connection> connections = new HashMap<String, Connection>();

    public static void initializeConnection(String alias, String url, String user, String pass, String driver) {
        Connection con;
        try {
            Class.forName(driver);
            con = DriverManager.getConnection(url, user, pass);
            connections.put(alias, con);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public static Connection getConnection(String alias) {
        return connections.get(alias);
    }
}
